package com.talentgame.tankspk.UIStage;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.utils.SpriteDrawable;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.talentgame.tankspk.GameCore.MyTouchPad;

/**
 * Created by 54560 on 2016/12/27.
 */
public class GameStage extends BaseStage{
    Texture joystickLeftTexture;
    Texture joystickRightTexture;
    Texture ThumbLeftTexture;
    Texture ThumbRightTexture;

    MyTouchPad.MyTouchPadStyle touchpadLeftStyle,touchpadRightStyle;
    public MyTouchPad touchPadLeft,touchPadRight;
    public GameStage(AssetManager assetManager) {
        super(assetManager);
        joystickLeftTexture = new Texture(Gdx.files.internal("ui/JoystickLeft.png"));
        joystickRightTexture = new Texture(Gdx.files.internal("ui/JoystickRight.png"));
        ThumbLeftTexture = new Texture(Gdx.files.internal("ui/ThumbLeft.png"));
        ThumbRightTexture = new Texture(Gdx.files.internal("ui/ThumbRight.png"));
        TextureRegionDrawable joyleftTr = new TextureRegionDrawable(new TextureRegion(joystickLeftTexture,joystickLeftTexture.getWidth(),joystickLeftTexture.getHeight()));
        TextureRegionDrawable joyrightTr = new TextureRegionDrawable(new TextureRegion(joystickRightTexture,joystickRightTexture.getWidth(),joystickRightTexture.getHeight()));
        TextureRegionDrawable thumebLeftTr = new TextureRegionDrawable(new TextureRegion(ThumbLeftTexture,ThumbLeftTexture.getWidth(),ThumbLeftTexture.getHeight()));
        TextureRegionDrawable thumebRightTr = new TextureRegionDrawable(new TextureRegion(ThumbRightTexture,ThumbRightTexture.getWidth(),ThumbRightTexture.getHeight()));
        touchpadLeftStyle = new MyTouchPad.MyTouchPadStyle(joyleftTr,thumebLeftTr);
        touchPadLeft = new MyTouchPad(1,touchpadLeftStyle);
        touchPadLeft.setBounds(90, 90, 300, 300);
        thumebLeftTr.setMinHeight(150);
        thumebLeftTr.setMinWidth(150);
        touchpadRightStyle = new MyTouchPad.MyTouchPadStyle(joyrightTr,thumebRightTr);
        touchPadRight = new MyTouchPad(1,touchpadRightStyle);
        touchPadRight.setBounds(1500,90,300,300);
        thumebRightTr.setMinHeight(150);
        thumebRightTr.setMinWidth(150);

        addActor(touchPadLeft);
        addActor(touchPadRight);


    }
}
